//
//  ZYHRequest.h
//  SchoolClient
//
//  Created by mac on 15/10/29.
//  Copyright © 2015年 mac. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ZYHRequest : NSObject<NSURLConnectionDataDelegate,NSURLConnectionDelegate>
{
    void (^_success)(id msg);
    void (^_failure)(NSError *error);
    NSMutableURLRequest *_request;
    NSURLConnection *_connection;
    NSMutableData *_responseData;
}

+ (BOOL)NetWorkIsOK;//检查网络是否可用

//同步GET请求(加密)
-(NSData *)getSyncEncryptRequest:(NSString *)urlStr
                      parameters:(NSMutableDictionary *)parameters;

//异步GET请求(加密)
-(void)getAsyncEncryptRequest:(NSString *)urlStr
                   parameters:(NSMutableDictionary *)parameters
                      success:(void(^)(id responseData))success
                      failure:(void(^)(NSError *error))failure;
//异步POST请求(加密)
-(void)postAsyncEncryptRequest:(NSString *)urlStr
                    parameters:(NSMutableDictionary *)parameters
                       success:(void (^)(id responseData))success
                       failure:(void (^)(NSError *error))failure;
//异步POST请求
-(void)postAsyncRequest:(NSString *)urlStr
             parameters:(NSMutableDictionary *)parameters
                success:(void (^)(id responseData))success
                failure:(void (^)(NSError *error))failure;

//异步POST上传头像到服务器
-(void)postAsyncImageRequest:(NSString *)urlStr
                   headImage:(NSData *)imageData
                  parameters:(NSDictionary *)parameters
                     success:(void (^)(id responseData))success
                     failure:(void (^)(NSError *error))failure;



@end
